How to remove java.sql.BatchUpdateException in Grails? [closed]
Posted
by
aman.nepid
on Programmers
See other posts from Programmers
or by aman.nepid
Published on 2012-06-01T05:26:27Z
Indexed on
2012/06/01
10:50 UTC
Read the original article
Hit count: 318
I have a domain like this:
class BusinessOrganization {
static hasMany = [organizationBusinessTypes:OrganizationBusinessType]
String name
String icon
static constraints = {
name(blank:false,unique:true)
icon(unique:true)
}
String toString() {
return "${name}"
}
}
When I save some data for first time it works fine. But when by the next time it shows this error :
Error 500: Internal Server Error
URI /nLocatePortal/businessOrganization/save
Class java.sql.BatchUpdateException
Message Batch entry 0 insert into business_organization (version, icon, name, id) values ('0', '', 'dddd', '2') was aborted. Call getNextException to see the cause.
**Around line 24 of grails-app/controllers/com/nlocate/portal/BusinessOrganizationController.groovy**
21:
22: def save() {
23: def businessOrganizationInstance = new BusinessOrganization(params)
24: if (!businessOrganizationInstance.save(flush: true)) {
25: render(view: "create", model: [businessOrganizationInstance: businessOrganizationInstance])
26: return
27: }
Please someone help me why this is happening. I am new to Grails. I have not modified the controllers but still I get this error.
© Programmers or respective owner